package org.jeecg.modules.front.pay;

import org.jeecg.common.exception.JeecgBootException;
import org.springframework.stereotype.Service;

@Service
public class PaymentFactory {
    public Payment createPayment(String platform, String way, String channel) {
        if (platform.equals("alibaba") && way.equals("scan")) {
            //返回一个支付宝扫描支付类型
            return new AliScan();
        } else if (platform.equals("tengxu") && way.equals("scan")) {
            //返回一个微信扫描支付类型
            return new WechatScan();
        } else if (platform.equals("Yinsheng") && way.equals("scan")) {
            if (channel.equals("alipay")) {
                return new YinshengAggregationForwardScan(channel);
            } else if (channel.equals("wechat")) {
                return new YinshengJsScan(channel);
            }
        }


        throw new JeecgBootException("Invalid payment type.");
    }
}
